Path: blob/master/Part 2 - Regression/Decision Tree Regression/[R] Decision Tree Regression.ipynb
1009 views
Classification And Regression Trees(CART) is a term introduced by Leo Breiman to refer Decision Tree algorithm which is used to predict using classification or regression model.
The algorithm split the data into several terminal leaves which denotes the average. Above we have two independent variables and one dependent variable. Depending on the value of two new independent variable we can predict the value of dependent variable with a more precise manner rather then the naive approach(where no matter what are the two new dependent variables are we will assign the value of average of all the points to the dependent variable corresponds to the two independent variable).
For exampe let's say we want to predict the dependent variable for two independent variable, X1 = 30, X2 = 100 (say).
The from the decision tree we can say that Y = -64.1 (as X1 < 20 => No, X2 < 170 => Yes and X1 < 40 = Yes)
Data Preprocessing
Fitting the Decision Tree Regression Model to the dataset
Predicting a new result
Visualising the Regression Model results
From the above graph it is obvious that we are getting an average value for each interval. Also the interval are:
1 to 6.5, 6.5 to 8.5, 8.5 to 9.5, 9.5 to 10.
Value of Salary for level from 6.5 and 8.5 is 250000.